package com.tiptop.server;

import com.google.gson.Gson;
import com.tiptop.ice.login.User;
import com.tiptop.ice.login._LoginServiceDisp;
import com.tiptop.mybatis.mapper.UserMapper;
import com.tiptop.mybatis.util.MySqlSession;

import Ice.Current;

/** 
 * 继承服务端stub代码_loginCtrDisp类 并实现login接口
 * 
 */  
@SuppressWarnings("serial")
public class LoginImpl extends _LoginServiceDisp{  
	@Override
	public User login(User msg, Current __current) {
		UserMapper dao = MySqlSession.getMapper(UserMapper.class);
		Gson gson = new Gson();
		User ei = gson.fromJson(gson.toJson(dao.load(msg.id)), User.class); 
		System.out.println(gson.toJson(ei));
		MySqlSession.close();
	    return ei;  
	}  
}